#!/bin/bash
extra_hosts=$1
echo $extra_hosts
if [[ -n ${extra_hosts} ]]; then
    sed -i "/volumes/i\    extra_hosts:" docker-compose.tpl
    echo $extra_hosts | tr "," "\n" > extra_hosts.txt
    while read line; do
        str=$(echo $line)
        echo $str
        sed -i "/extra_hosts/a\      - $str" docker-compose.tpl
    done < extra_hosts.txt
fi
